package com.wxzz.elearing.livetelecast.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wxzz.elearing.livetelecast.dto.MyWatchPlatformLivetelecastDto;
import com.wxzz.elearing.livetelecast.entity.PlatformLivetelecast;
import com.wxzz.elearing.livetelecast.entity.WxUserPlatformLivetelecast;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Optional;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author
 * @since 2021-04-02
 */
public interface WxUserPlatformLivetelecastMapper extends BaseMapper<WxUserPlatformLivetelecast> {

    @Select("SELECT * FROM `wx_user_platform_livetelecast` WHERE wx_user_id = #{wxUserId} AND type = 0 AND platform_livetelecast_id = #{platformLivetelecastId} AND deleted = 0")
    Optional<WxUserPlatformLivetelecast> selectWxUserPlatformLivetelecastOne(@Param("wxUserId") Long wxUserId, @Param("platformLivetelecastId") Long platformLivetelecastId);

    /**
     * 已观看的直播列表
     *
     * @param wxUserId
     * @param myWatchPlatformLivetelecastDto
     * @return
     */
    List<PlatformLivetelecast> listMyWatchWxUserPlatformLivetelecast(@Param("wxUserId") Long wxUserId, @Param("myWatchPlatformLivetelecastDto") MyWatchPlatformLivetelecastDto myWatchPlatformLivetelecastDto);

}
